package com.flying.oop_demo1;

/**
 * @author 刘鹏飞
 * @ClassName OOPTest
 * @Date 2024/12/2 22:27
 * @Created by 刘鹏飞
 * @Description
 */
public class OOPTest {
    public static void main(String[] args) {

        // 对象的创建
        // 使用 new关键字
        Dog dog = new Dog();
        dog.name="大黄";
        dog.age=2;
        dog.color="blank";
        dog.jueyu=true;

        // 访问对象的属性和方法
        // 使用 . 操作符
        System.out.println(dog.name);
        System.out.println(dog.age);
        System.out.println(dog.color);
        System.out.println(dog.jueyu);
        dog.eat("骨头");
        dog.shut();
        dog.sleep();

        // new 关键字在底层到底做了哪些操作？？

        Point point = new Point(3, 4);
        System.out.println(point.length(new Point(6, 8)));


        //  构造器的重载
        // 调用不同的构造器创建对象
        Dog dog1 = new Dog();
        Dog dog2 = new Dog("小白");
        Dog dog3 = new Dog("小黑", 5, "黑色", false);


    }
}
